package com.ctgu.frequence.Utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class GetString {
    private static byte[] bytes = new byte[1024];

    public static String getString(File file) throws IOException {
        StringBuffer sb = new StringBuffer();
        FileInputStream in = new FileInputStream(file);
        int len;
        while((len = in.read(bytes)) != -1){
            sb.append(new String(bytes,0,len));
        }
        in.close();
        String str = sb.toString(); //得到文件的内容
        return str;

    }
}
